import { Component, OnInit } from '@angular/core';
import { EventBusService } from '../common/event-bus.service';

@Component({
  selector: 'app-main',
  templateUrl: './main.component.html',
  styleUrls: ['./main.component.less'],
})
export class MainComponent implements OnInit {
  constructor(private eventBus: EventBusService) {}

  top = '100%';
  ngOnInit(): void {
    this.eventBus.bus.subscribe((res: string) => {
      this.top = res || '0';
    });
  }
  get url() {
    return location.pathname;
  }
  clientY;
  touchmoveAdd(evt) {
    if (!this.clientY) {
      this.clientY = evt.changedTouches[0].clientY;
    }
  }
  toushendAdd(evt) {
    if (evt.changedTouches[0].clientY > this.clientY) {
      this.top = '100%';
    }
    this.clientY = undefined;
  }
}
